g_slist_foreach (trap->displays, (GFunc) g_object_ref, NULL);
for (l = trap->displays; l != NULL; l = l->next)
- {
- class->push_error_trap (l->data);
- }
+ class->push_error_trap (l->data);
g_queue_push_head (&gdk_error_traps, trap);
}
std = data;
- g_slist_foreach (std->contexts, (GFunc) free_startup_notification_data, NULL);
- g_slist_free (std->contexts);
+ g_slist_free_full (std->contexts, free_startup_notification_data);
if (std->timeout_id != 0)
{
XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
/* List of event window extraction functions */
- g_slist_foreach (display_x11->event_types, (GFunc)g_free, NULL);
- g_slist_free (display_x11->event_types);
+ g_slist_free_full (display_x11->event_types, g_free);
/* input GdkDevice list */
g_list_free_full (display_x11->input_devices, g_object_unref);
rc_style->rc_properties = NULL;
}
- g_slist_foreach (rc_style->icon_factories, (GFunc) g_object_unref, NULL);
- g_slist_free (rc_style->icon_factories);
-
- g_slist_foreach (rc_priv->color_hashes, (GFunc) g_hash_table_unref, NULL);
- g_slist_free (rc_priv->color_hashes);
+ g_slist_free_full (rc_style->icon_factories, g_object_unref);
+ g_slist_free_full (rc_priv->color_hashes, (GDestroyNotify)g_hash_table_unref);
G_OBJECT_CLASS (gtk_rc_style_parent_class)->finalize (object);
}
}
}
- g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL);
- g_slist_free (style->icon_factories);
+ g_slist_free_full (style->icon_factories, g_object_unref);
pango_font_description_free (style->font_desc);
if (src->rc_style)
g_object_ref (src->rc_style);
- g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL);
- g_slist_free (style->icon_factories);
+ g_slist_free_full (style->icon_factories, g_object_unref);
style->icon_factories = g_slist_copy (src->icon_factories);
g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
}
g_strfreev (priv->artists);
g_slist_free_full (priv->credit_sections, destroy_credit_section);
-
- g_slist_foreach (priv->visited_links, (GFunc)g_free, NULL);
- g_slist_free (priv->visited_links);
+ g_slist_free_full (priv->visited_links, g_free);
G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object);
}
}
}
- if (tags)
- g_slist_free (tags);
+ g_slist_free (tags);
}
static gboolean
gdk_window_set_device_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), device, priv->regular_cursor);
}
- if (tags)
- g_slist_free (tags);
+ g_slist_free (tags);
}
static gboolean
#include "gtkfilechooser.h" /* for the GError types */
static void
-_gtk_bookmark_free (GtkBookmark *bookmark)
+_gtk_bookmark_free (gpointer data)
{
+ GtkBookmark *bookmark = data;
+
g_object_unref (bookmark->file);
g_free (bookmark->label);
g_slice_free (GtkBookmark, bookmark);
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
case G_FILE_MONITOR_EVENT_DELETED:
- g_slist_foreach (manager->bookmarks, (GFunc) _gtk_bookmark_free, NULL);
- g_slist_free (manager->bookmarks);
-
+ g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
manager->bookmarks = read_bookmarks (file);
gdk_threads_enter ();
g_object_unref (manager->bookmarks_monitor);
}
- if (manager->bookmarks)
- {
- g_slist_foreach (manager->bookmarks, (GFunc) _gtk_bookmark_free, NULL);
- g_slist_free (manager->bookmarks);
- }
+ g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
g_free (manager);
}
if (priv->callbacks)
g_hash_table_destroy (priv->callbacks);
- g_slist_foreach (priv->signals, (GFunc) _free_signal_info, NULL);
- g_slist_free (priv->signals);
+ g_slist_free_full (priv->signals, (GDestroyNotify)_free_signal_info);
G_OBJECT_CLASS (gtk_builder_parent_class)->finalize (object);
}
connect_object, signal->flags, user_data);
}
- g_slist_foreach (builder->priv->signals, (GFunc)_free_signal_info, NULL);
- g_slist_free (builder->priv->signals);
+ g_slist_free_full (builder->priv->signals, (GDestroyNotify)_free_signal_info);
builder->priv->signals = NULL;
if (detailed_id)
{
/* Do not free the signal items, which GtkBuilder takes ownership of */
g_slist_free (info->signals);
- g_slist_foreach (info->properties,
- (GFunc)free_property_info, NULL);
- g_slist_free (info->properties);
+ g_slist_free_full (info->properties, (GDestroyNotify)free_property_info);
g_free (info->constructor);
g_free (info->id);
g_slice_free (ObjectInfo, info);
out:
- g_slist_foreach (data->stack, (GFunc)free_info, NULL);
- g_slist_free (data->stack);
- g_slist_foreach (data->custom_finalizers, (GFunc)free_subparser, NULL);
- g_slist_free (data->custom_finalizers);
+ g_slist_free_full (data->stack, (GDestroyNotify)free_info);
+ g_slist_free_full (data->custom_finalizers, (GDestroyNotify)free_subparser);
g_slist_free (data->finalizers);
- g_slist_foreach (data->requested_objects, (GFunc) g_free, NULL);
- g_slist_free (data->requested_objects);
+ g_slist_free_full (data->requested_objects, g_free);
g_free (data->domain);
g_hash_table_destroy (data->object_ids);
g_markup_parse_context_free (data->ctx);
if (info->destroy)
info->destroy (info->data);
- g_slist_foreach (info->attributes, (GFunc)cell_attribute_free, NULL);
- g_slist_free (info->attributes);
+ g_slist_free_full (info->attributes, (GDestroyNotify)cell_attribute_free);
g_slice_free (CellInfo, info);
}
if (info)
{
- g_slist_foreach (info->attributes, (GFunc)cell_attribute_free, NULL);
- g_slist_free (info->attributes);
-
+ g_slist_free_full (info->attributes, (GDestroyNotify)cell_attribute_free);
info->attributes = NULL;
}
}
break;
}
- g_slist_foreach (allocated_cells, (GFunc)allocated_cell_free, NULL);
- g_slist_free (allocated_cells);
+ g_slist_free_full (allocated_cells, (GDestroyNotify)allocated_cell_free);
}
static void
-gtk_cell_area_box_apply_attributes (GtkCellArea *area,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gboolean is_expander,
- gboolean is_expanded)
+gtk_cell_area_box_apply_attributes (GtkCellArea *area,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gboolean is_expander,
+ gboolean is_expanded)
{
GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area);
GtkCellAreaBoxPrivate *priv = box->priv;
/* Call the parent class to apply the attributes */
GTK_CELL_AREA_CLASS
- (gtk_cell_area_box_parent_class)->apply_attributes (area, tree_model, iter,
+ (gtk_cell_area_box_parent_class)->apply_attributes (area, tree_model, iter,
is_expander, is_expanded);
/* Update visible state for cell groups */
files = gtk_file_chooser_get_files (chooser);
result = files_to_strings (files, g_file_get_path);
- g_slist_foreach (files, (GFunc) g_object_unref, NULL);
- g_slist_free (files);
+ g_slist_free_full (files, g_object_unref);
return result;
}
else
result = files_to_strings (files, g_file_get_uri);
- g_slist_foreach (files, (GFunc) g_object_unref, NULL);
- g_slist_free (files);
+ g_slist_free_full (files, g_object_unref);
return result;
}
result = list->data;
list = g_slist_delete_link (list, list);
- g_slist_foreach (list, (GFunc) g_object_unref, NULL);
- g_slist_free (list);
+ g_slist_free_full (list, g_object_unref);
}
return result;
folders = _gtk_file_chooser_list_shortcut_folder_files (chooser);
result = files_to_strings (folders, g_file_get_path);
- g_slist_foreach (folders, (GFunc) g_object_unref, NULL);
- g_slist_free (folders);
+ g_slist_free_full (folders, g_object_unref);
return result;
}
folders = _gtk_file_chooser_list_shortcut_folder_files (chooser);
result = files_to_strings (folders, g_file_get_uri);
- g_slist_foreach (folders, (GFunc) g_object_unref, NULL);
- g_slist_free (folders);
+ g_slist_free_full (folders, g_object_unref);
return result;
}
list = _gtk_bookmarks_manager_list_bookmarks (priv->bookmarks_manager);
model_add_bookmarks (button, list);
- g_slist_foreach (list, (GFunc) g_object_unref, NULL);
- g_slist_free (list);
+ g_slist_free_full (list, g_object_unref);
model_add_other (button);
bookmarks = _gtk_bookmarks_manager_list_bookmarks (priv->bookmarks_manager);
model_remove_rows (user_data,
- model_get_type_position (user_data,
- ROW_TYPE_BOOKMARK_SEPARATOR),
- (priv->n_bookmarks + priv->has_bookmark_separator));
+ model_get_type_position (user_data, ROW_TYPE_BOOKMARK_SEPARATOR),
+ priv->n_bookmarks + priv->has_bookmark_separator);
priv->has_bookmark_separator = FALSE;
priv->n_bookmarks = 0;
model_add_bookmarks (user_data, bookmarks);
- g_slist_foreach (bookmarks, (GFunc) g_object_unref, NULL);
- g_slist_free (bookmarks);
+ g_slist_free_full (bookmarks, g_object_unref);
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter_model));
sensitive = (uris != NULL);
gtk_widget_set_sensitive (button, sensitive);
- if (uris)
- g_slist_free_full (uris, g_free);
+ g_slist_free_full (uris, g_free);
}
static void
gtk_file_chooser_widget_select_file (GTK_FILE_CHOOSER (impl), file, NULL); /* NULL-GError */
}
- g_slist_foreach (files, (GFunc) g_object_unref, NULL);
- g_slist_free (files);
+ g_slist_free_full (files, g_object_unref);
}
/* Callback used when the "Open this folder" menu item is activated */
g_free (uri);
}
- g_slist_foreach (files, (GFunc) g_object_unref, NULL);
- g_slist_free (files);
+ g_slist_free_full (files, g_object_unref);
}
/* callback used when the "Show Hidden Files" menu item is toggled */
}
}
- g_slist_foreach (files, (GFunc) g_object_unref, NULL);
- g_slist_free (files);
+ g_slist_free_full (files, g_object_unref);
}
static gboolean
{
GtkFileFilter *filter = GTK_FILE_FILTER (object);
- g_slist_foreach (filter->rules, (GFunc)filter_rule_free, NULL);
- g_slist_free (filter->rules);
+ g_slist_free_full (filter->rules, (GDestroyNotify)filter_rule_free);
g_free (filter->name);
if (priv->volumes)
{
- g_slist_foreach (priv->volumes, (GFunc) g_object_unref, NULL);
- g_slist_free (priv->volumes);
+ g_slist_free_full (priv->volumes, g_object_unref);
priv->volumes = NULL;
}
if (priv->volumes)
{
- g_slist_foreach (priv->volumes, (GFunc) g_object_unref, NULL);
- g_slist_free (priv->volumes);
+ g_slist_free_full (priv->volumes, g_object_unref);
priv->volumes = NULL;
}
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (obj);
GtkIMContextSimplePrivate *priv = context_simple->priv;
- if (priv->tables)
- {
- g_slist_foreach (priv->tables, (GFunc)g_free, NULL);
- g_slist_free (priv->tables);
-
- priv->tables = NULL;
- }
+ g_slist_free_full (priv->tables, g_free);
+ priv->tables = NULL;
G_OBJECT_CLASS (gtk_im_context_simple_parent_class)->finalize (obj);
}
if (have_error)
{
- GSList *tmp_list = infos;
- while (tmp_list)
- {
- free_info (tmp_list->data);
- tmp_list = tmp_list->next;
- }
- g_slist_free (infos);
-
+ g_slist_free_full (infos, (GDestroyNotify)free_info);
g_object_unref (module);
}
else if (module)
clos);
}
- g_slist_foreach (bookmarks, (GFunc) g_object_unref, NULL);
- g_slist_free (bookmarks);
+ g_slist_free_full (bookmarks, g_object_unref);
/* Add new bookmark row */
new_bookmark_icon = g_themed_icon_new ("bookmark-new-symbolic");
if (impl->priv->filters)
{
- g_slist_foreach (impl->priv->filters, (GFunc) g_object_unref, NULL);
- g_slist_free (impl->priv->filters);
+ g_slist_free_full (impl->priv->filters, g_object_unref);
impl->priv->filters = NULL;
}
if (recent_info->applications)
{
- g_slist_foreach (recent_info->applications,
- (GFunc) recent_app_info_free,
- NULL);
- g_slist_free (recent_info->applications);
-
+ g_slist_free_full (recent_info->applications, (GDestroyNotify)recent_app_info_free);
recent_info->applications = NULL;
}
if (recent_info->groups)
{
- g_slist_foreach (recent_info->groups,
- (GFunc) g_free,
- NULL);
- g_slist_free (recent_info->groups);
-
+ g_slist_free_full (recent_info->groups, g_free);
recent_info->groups = NULL;
}
tmp_list = tmp_list->next;
}
- g_slist_foreach (tags, (GFunc) g_object_unref, NULL);
-
- g_slist_free (tags);
+ g_slist_free_full (tags, g_object_unref);
}
gtk_text_child_anchor_finalize (GObject *obj)
{
GtkTextChildAnchor *anchor;
- GSList *tmp_list;
GtkTextLineSegment *seg;
anchor = GTK_TEXT_CHILD_ANCHOR (obj);
"and the refcount is 0.");
return;
}
-
- tmp_list = seg->body.child.widgets;
- while (tmp_list)
- {
- g_object_unref (tmp_list->data);
- tmp_list = g_slist_next (tmp_list);
- }
-
- g_slist_free (seg->body.child.widgets);
+
+ g_slist_free_full (seg->body.child.widgets, g_object_unref);
g_slice_free1 (WIDGET_SEG_SIZE, seg);
}
tooltip_query_idle (gpointer data)
{
g_slist_foreach (tooltip_query_displays, (GFunc)gtk_tooltip_trigger_tooltip_query, NULL);
- g_slist_foreach (tooltip_query_displays, (GFunc)g_object_unref, NULL);
- g_slist_free (tooltip_query_displays);
+ g_slist_free_full (tooltip_query_displays, g_object_unref);
tooltip_query_displays = NULL;
tooltip_query_id = 0;